package com.gopay.common.domain.aggregatepayment;

import com.gopay.common.domain.BaseEntity;

import javax.persistence.*;
import java.util.Date;

/**
 * @author Chenyu Li
 * @description 聚合支付门店合同关联表
 * @date 2017/12/29
 * Copyright (c) 2017. www.gopay.com.cn Inc.All rights reserved.
 */
@Entity
@Table(name = "AP_SHOP_CONTRACT_REL")
public class ApShopContractRel extends BaseEntity {
    private Integer id;
    private String cttId;
    private String shopNo;
    private String custId;
    private Date createdTs;
    private Date lastUpdTs;
    private int version;
    private String status;

    @Basic
    @Column(name = "STATUS", nullable = false, length = 1)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Id
    @SequenceGenerator(name = "AP_SHOP_CONTRACT_REL_SEQ_GENERATOR", sequenceName = "AP_SHOP_CONTRACT_REL_SEQ", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AP_SHOP_CONTRACT_REL_SEQ_GENERATOR")
    @Column(name = "ID", nullable = false, precision = 0)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "CTT_ID", nullable = true, length = 20)
    public String getCttId() {
        return cttId;
    }

    public void setCttId(String cttId) {
        this.cttId = cttId;
    }

    @Basic
    @Column(name = "SHOP_NO", nullable = true, length = 20)
    public String getShopNo() {
        return shopNo;
    }

    public void setShopNo(String shopNo) {
        this.shopNo = shopNo;
    }

    @Basic
    @Column(name = "CUST_ID", nullable = false, length = 10)
    public String getCustId() {
        return custId;
    }

    public void setCustId(String custId) {
        this.custId = custId;
    }

    @Basic
    @Column(name = "CREATED_TS", nullable = false)
    public Date getCreatedTs() {
        return createdTs;
    }

    public void setCreatedTs(Date createdTs) {
        this.createdTs = createdTs;
    }

    @Basic
    @Column(name = "LAST_UPD_TS", nullable = false)
    public Date getLastUpdTs() {
        return lastUpdTs;
    }

    public void setLastUpdTs(Date lastUpdTs) {
        this.lastUpdTs = lastUpdTs;
    }

    @Basic
    @Column(name = "VERSION", nullable = true, precision = 0)
    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ApShopContractRel that = (ApShopContractRel) o;

        if (version != that.version) {
            return false;
        }
        if (id != null ? !id.equals(that.id) : that.id != null) {
            return false;
        }
        if (cttId != null ? !cttId.equals(that.cttId) : that.cttId != null) {
            return false;
        }
        if (shopNo != null ? !shopNo.equals(that.shopNo) : that.shopNo != null) {
            return false;
        }
        if (custId != null ? !custId.equals(that.custId) : that.custId != null) {
            return false;
        }
        if (createdTs != null ? !createdTs.equals(that.createdTs) : that.createdTs != null) {
            return false;
        }
        if (lastUpdTs != null ? !lastUpdTs.equals(that.lastUpdTs) : that.lastUpdTs != null) {
            return false;
        }
        if (status != that.status) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (cttId != null ? cttId.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (shopNo != null ? shopNo.hashCode() : 0);
        result = 31 * result + (custId != null ? custId.hashCode() : 0);
        result = 31 * result + (createdTs != null ? createdTs.hashCode() : 0);
        result = 31 * result + (lastUpdTs != null ? lastUpdTs.hashCode() : 0);
        result = 31 * result + version;
        return result;
    }
}
